package com.rqf.ls.controller;

import java.util.Map;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.rqf.common.base.ProjectInfor;
import com.rqf.ls.service.IManagementBenefitService;
import com.server.web.DataVector;
import com.server.web.JSONSerielizer;
import com.server.web.OutputUtil;
import com.server.web.RequestInput;

/**
 * @author  作者 E-mail: 
 * @date 创建时间：2016年5月18日 下午2:11:34 
 * @version 1.0 
 * @parameter 
 * @since 
 * @return  
 */
@Controller
@RequestMapping("public")
public class ManagementBenefitController {
	@Autowired
	private IManagementBenefitService benefitService;
	@RequestMapping("")
	public ModelAndView publicMv(){
		ModelAndView mv = new ModelAndView("manager/public/publicList");
		mv.addObject("rootPath", ProjectInfor.ROOT_PATH);
		return mv;
	}
	@RequestMapping("listData/{type}")
	public void listData(HttpServletRequest request, 
			HttpServletResponse response, @PathVariable String type){
		RequestInput requestInput = new RequestInput(request);
		DataVector<Map<String, Object>> list = benefitService.userList(requestInput, type);
		OutputUtil.returnGridData(response, list.getCount(), JSONSerielizer.toJson(list.getList(), null, null));
		
	}
	@RequestMapping("signUp_listData/{type}/{phoneNo}")
	public void user_listData(HttpServletRequest request, 
			HttpServletResponse response, @PathVariable String phoneNo,@PathVariable String type){
		RequestInput requestInput = new RequestInput(request);
		DataVector<Map<String, Object>> list = benefitService.getList(requestInput, phoneNo, type);
		OutputUtil.returnGridData(response, list.getCount(), JSONSerielizer.toJson(list.getList(), null, null));
		
	}
	@RequestMapping("map")
	public ModelAndView mapMv(){
		ModelAndView mv = new ModelAndView("manager/public/map");
		mv.addObject("rootPath", ProjectInfor.ROOT_PATH);
		return mv;
	}

}
